<!
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>支付界面</title>
    <script type="text/javascript" src="{{asset('js/jquery.min.js')}}"></script>
</head>
<body>
<h2>系统订单号：{{$order['plat_no']}}</h2>
<h2>商户订单号：{{$order['merchant_no']}}</h2>

<p>二维码</p>
<div>
    {!! QrCode::encoding('UTF-8')->size(200)->generate($qrCode) !!}
    <p style="color: red">请在5分钟之内支付</p>
    <p style="color: red">支付前请不要刷新本页</p>
</div>
<p>充值金额：{{$order['order_amt']}}</p>

<script type="text/javascript">
    var timer = 5 * 30;
    var timerId = setInterval("queryOrder()", 2000);
    $(function () {
        timerId();
    });

    function queryOrder() {
        if (timer > 0) {
            timer--;
            $.get('{{route('gateway.recharge.query')}}', {'orderNo': '{{$order['plat_no']}}'}, function (data) {
                if (data.code == 1) {
                    window.location.href = '{{route('gateway.recharge.success')}}?orderNo=' + '{{$order['plat_no']}}';
                    clearInterval(timerId);
                }
                if (data.code == -1) {
{{--                    window.location.href = '{{route('error')}}';--}}
                    console.log('order not found');
                }
            })
        } else {
            clearInterval(timerId);
        }
    }
</script>
</body>
</html>
